import request from './request'

// 登录
export const loginApi = (username, password) => request.post('/auth/login', { username, password })

// 获取当前用户信息
export const getCurrentUserApi = () => request.get('/auth/current')

// 更新用户信息
export const updateUserApi = data => request.put('/auth/update', data)

// 修改密码
export const changePasswordApi = (oldPassword, newPassword) => request.put('/auth/change-password', null, {
    params: { oldPassword, newPassword }
})

// 注册用户
export const registerApi = data => request.post('/auth/register', data)

export const getUserListApi = params => request.get('/user/list', { params })
export const addUserApi = data => request.post('/user/add', data)
export const deleteUserApi = id => request.delete(`/user/delete/${id}`) 